<?php
$curPageURL='http';
if($_SERVER["HTTPS"]=="on"){ $curPageURL .= "s"; }
$curPageURL.="://";
if($_SERVER["SERVER_PORT"]!="80"){
  $curPageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
}
else $curPageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
?>